﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Media.Imaging;

namespace TestWP.GameCore
{
    class ImageProcess
    {
        public static List<WriteableBitmap> cropImg(WriteableBitmap imgOrigin,int imgWidthCount)
        {
            List<WriteableBitmap> rs = new List<WriteableBitmap>();
            int imgRSWidth = imgOrigin.PixelWidth / imgWidthCount;
            int imgRSHeight = imgOrigin.PixelHeight / imgWidthCount;
            WriteableBitmap tempImg = null;
            for (int i = 0; i < imgWidthCount; i++)
            {
                for (int j = 0; j < imgWidthCount; j++)
                {
                    tempImg = imgOrigin.Crop(j * imgRSWidth, i * imgRSHeight, imgRSWidth, imgRSHeight);
                    rs.Add(tempImg);
                }
            }
            
            return rs;
        }
        
    }
}
